package com.skynet.supervision.schedule;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.SneakyThrows;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.StringUtils;

import java.util.Date;
import java.util.List;

//1.主要用于标记配置类，兼备Component的效果。
@Configuration
// 2.开启定时任务
@EnableScheduling
@EnableAsync
public class TaskScheduleUpdate {


    /**
     * 凌晨0：00，中午12：00更新
     */
    @Scheduled(cron="0 0 0,12 ? * ?")
    @Async
    @SneakyThrows
    public void updates(){
        //查询中，和调取中的任务


    }

    /**
     * 求两个时间相差多少秒
     *
     * @param stratDate
     * @param endData
     * @return
     */
    public Integer getDifferSecond(Long stratDate, Long endData) {
        Long interval = endData - stratDate;
        return interval.intValue();
    }

}
